package resource

import (
	"micro-grpc-server/services/wechat/internal/models"
	pb "micro-grpc-server/services/wechat/proto"
)

type UserResource struct{}

// 用户模型转pb
func (r *UserResource) UserToProto(user *models.User) *pb.User {
	var u = &pb.User{
		Id:            user.Id,
		OpenId:        user.Openid,
		UnionId:       user.UnionId,
		Avatar:        user.Avatar,
		Name:          user.Name,
		IsFollow:      user.IsFollow,
		TimeSubscribe: user.TimeSubscribe,
		TimeActive:    user.TimeActive,
		Gender:        user.Gender,
		City:          user.City,
		Country:       user.Country,
		Province:      user.Province,
		TimeJoin:      user.TimeJoin,
	}
	return u
}
